home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 April / macformat-023.iso / Shareware City / Developers / NeoPersist 3.0.8 folder / NeoIncludes / CNeoIndexIterator.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-13  |  2.2 KB  |  65 lines  |  [TEXT/MMCC]

  1. /************************************************************
  2.  *
  3.  *    Created: Sunday, December 7, 1992 8:56:00 PM
  4.  *    CNeoIndexIterator.h
  5.  *    C++ class definition for index iterator class
  6.  *
  7.  *
  8.  *    Copyright © Neologic Systems 1992-1994. All Rights Reserved.
  9.  *    All rights reserved
  10.  *
  11.  *
  12.  * Within a class, references to permanent objects are kept
  13.  * in a sorted list called an index. It is often necessary to
  14.  * serial traverse a list of objects in an index. Iterators
  15.  * make the process of traversing an index easier. They also
  16.  * allow indices to be used as all other collection classes.
  17.  *
  18.  ***********************************************************/
  19. #pragma once            /* Include this file only once */
  20. #ifndef __CNeoIndexIterator__
  21. #define __CNeoIndexIterator__ 1
  22.  
  23. #include "NeoTypes.h"
  24. #include CNeoIteratorNativeH
  25.  
  26. class CNeoDatabase;
  27.  
  28. class CNeoIndexIterator : public CNeoIteratorNative {
  29. public:
  30.                         /** Instance Methods **/
  31.                         CNeoIndexIterator(CNeoDatabase *aDatabase, const NeoID aClassID, CNeoSelect *aKey = nil, const Boolean aDeeply = FALSE, const Boolean aForward = TRUE);
  32.     virtual                ~CNeoIndexIterator(void);
  33.  
  34.                         /** Access Methods **/
  35.     NeoID                getBaseClass(void) const {return fClassID;}
  36.     NeoID                getCurrentClass(void) const {return fCurrentClassID;}
  37.     CNeoDatabase *        getDatabase(void) const {return fDatabase;}
  38.     Boolean                isDeeply(void) const {return fDeeply;}
  39.  
  40.                         /** Object List Management Methods **/
  41.     virtual CNeoPersist *
  42.                         currentObject(void);
  43.     virtual void *        doUntil(NeoTestFunc1 aFunc, void *aParam = nil);
  44.     virtual Boolean        leap(const long aDelta);
  45.     virtual CNeoPersist *
  46.                         nextObject(void);
  47.     virtual CNeoPersist *
  48.                         previousObject(void);
  49.     virtual CNeoNode *    removeCurrent(void);
  50.     virtual void        reset(void);
  51.  
  52.     Boolean                fDeeply;                // Do we include all subclasses as well?
  53.     unsigned char        fFiller;                // for word alignment
  54.     NeoID                fClassID;                // Identity of the base class.
  55.     CNeoDatabase *        fDatabase;                // The database that the objects are in.
  56.  
  57. protected:
  58.     virtual Boolean        advance(const short aDelta);
  59.     virtual Boolean        cross(const Boolean aForward = TRUE);
  60.  
  61.     NeoID                fCurrentClassID;        // May differ from fClassID if fDeeply
  62.     NeoID                fSysClassID;            // Class id of leaf nodes
  63. };
  64. #endif
  65.